home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!cs.utexas.edu!sun-barr!cronkite.Central.Sun.COM!jethro!exodus!cetia1.cetia.fr
- From: mmm@cetia1.cetia.fr (Mark Martin)
- Newsgroups: comp.sources.x
- Subject: v13i078: unclutter, Patch1, Part01/01
- Message-ID: <16947@exodus.Eng.Sun.COM>
- Date: 16 Jul 91 23:48:01 GMT
- References: <csx-13i078-unclutter@uunet.UU.NET>
- Sender: news@exodus.Eng.Sun.COM
- Lines: 464
- Approved: argv@sun.com
-
- Submitted-by: Mark Martin <mmm@cetia1.cetia.fr>
- Posting-number: Volume 13, Issue 78
- Archive-name: unclutter/patch1
- Patch-To: unclutter: Volume 13, Issue 5
-
- This is a shar of a patch file to unclutter version and patchlevel 2.
- It introduces a -visible option to ignore the strange visibility events
- that are being generated by some servers when the cursor-grabbing
- input-only window is created, and which cause the cursor to flicker
- but not disappear. It also has a -not option to exclude specific windows
- from the list to unclutter. I dont envisage any further developments.
-
- Thanks for their help with "remote debugging" via xscope of various servers to
- dave edsall@iastate.edu
- Roland McGrath <roland@geech.gnu.ai.mit.edu>
- Rainer Sinkwitz <sinkwitz@ifi.unizh.ch>
- Michael L. Brown astroatc!ftms!brown@cs.wisc.edu
- patti@hosehead.hf.intel.com
- and, for vroot.h, Andreas Stolcke <stolcke@ICSI.Berkeley.EDU>
- and to all those who tested various development versions sent by mail.
-
- Mark M Martin mmm@cetia.fr
- Cetia (BP 244), inria!cetia!mmm
- 150 rue Marcelin Berthelot, tel +33 94 08 80 00
- ZI Toulon Est, fax +33 94 08 80 01
- 83078 TOULON CEDEX 9, France
- ------
- #! /bin/sh
- # This is a shell archive, meaning:
- # 1. Remove everything above the #! /bin/sh line.
- # 2. Save the resulting text in a file.
- # 3. Execute the file with /bin/sh (not csh) to create the files:
- # patches.3
- # This archive created: Tue Jun 18 18:37:32 FDT 1991
- # By: mmm
- # Part 1 of 1
- PATH=/bin:$PATH export PATH
- if test -f 'patches.3'
- then echo "shar: will not overwrite existing file patches.3"
- else echo "shar: extracting patches.3 (13123 chars)"
- sed 's/^X//' <<\END-OF-FILE! >'patches.3'
- Xdiff -r -c old/README unclutter/README
- X*** old/README Tue Jun 18 18:15:51 1991
- X--- unclutter/README Thu May 30 12:30:29 1991
- X***************
- X*** 16,22 ****
- X will apparently leave the window, even though its x y position doesnt change.
- X
- X The first version of this program used a grab to remove the cursor.
- X! This methid is still available with a "-grab" option to the program.
- X
- X The program is released into the public domain. Only the considerate
- X will leave credit for the author.
- X--- 16,31 ----
- X will apparently leave the window, even though its x y position doesnt change.
- X
- X The first version of this program used a grab to remove the cursor.
- X! This method is still available with a "-grab" option to the program.
- X!
- X! Thanks for their help with "remote debugging" with xscope of various servers to
- X! dave edsall@iastate.edu
- X! Roland McGrath <roland@geech.gnu.ai.mit.edu>
- X! Rainer Sinkwitz <sinkwitz@ifi.unizh.ch>
- X! Michael L. Brown astroatc!ftms!brown@cs.wisc.edu
- X! patti@hosehead.hf.intel.com
- X! and, for vroot.h, Andreas Stolcke <stolcke@ICSI.Berkeley.EDU>
- X! and to all those who tested various development versions sent by mail.
- X
- X The program is released into the public domain. Only the considerate
- X will leave credit for the author.
- Xdiff -r -c old/patchlevel.h unclutter/patchlevel.h
- X*** old/patchlevel.h Tue Jun 18 18:15:53 1991
- X--- unclutter/patchlevel.h Tue Jun 18 18:11:50 1991
- X***************
- X*** 4,8 ****
- X * level 1: -grab option to use old method, new method creates small input
- X * only sub-window. (distributed by mail only, not posted)
- X * level 2: use Andreas Stolcke's vroot.h for tvtwm and similar winmans.
- X */
- X! #define PATCHLEVEL 2
- X--- 4,10 ----
- X * level 1: -grab option to use old method, new method creates small input
- X * only sub-window. (distributed by mail only, not posted)
- X * level 2: use Andreas Stolcke's vroot.h for tvtwm and similar winmans.
- X+ * level 3: -not option takes list of windows to avoid and -visible ignores
- X+ * visibility events for some servers.
- X */
- X! #define PATCHLEVEL 3
- Xdiff -r -c old/unclutter.c unclutter/unclutter.c
- X*** old/unclutter.c Tue Jun 18 18:15:47 1991
- X--- unclutter/unclutter.c Tue Jun 18 18:11:50 1991
- X***************
- X*** 8,13 ****
- X--- 8,16 ----
- X * shapes depending on whether they have pointer focus or not.
- X * Whereas version 1 did a grab cursor, version 2 creates a small subwindow.
- X * This may work better with some window managers.
- X+ * Some servers return a Visibility event when the subwindow is mapped.
- X+ * Sometimes this is Unobscured, or even FullyObscured. Ignore these and
- X+ * rely on LeaveNotify events.
- X * Mark M Martin. cetia 1991 mmm@cetia.fr
- X */
- X #include <X11/Xos.h>
- X***************
- X*** 30,36 ****
- X -grab use grabpointer method not createwindow\n\
- X -reset reset the timer whenever cursor becomes\n\
- X visible even if it hasn't moved\n\
- X! -root apply to cursor on root window too");
- X }
- X
- X #define ALMOSTEQUAL(a,b) (abs(a-b)<=jitter)
- X--- 33,42 ----
- X -grab use grabpointer method not createwindow\n\
- X -reset reset the timer whenever cursor becomes\n\
- X visible even if it hasn't moved\n\
- X! -root apply to cursor on root window too\n\
- X! -visible ignore visibility events\n\
- X! -not names... dont apply to windows whose wm-name begins.\n\
- X! (must be last argument)");
- X }
- X
- X #define ALMOSTEQUAL(a,b) (abs(a-b)<=jitter)
- X***************
- X*** 51,61 ****
- X (*defaulthandler)(display,error);
- X }
- X
- X main(argc,argv)char **argv;{
- X Display *display;
- X Cursor cursor;
- X int screen,oldx,oldy = -99;
- X! int doroot = 0, jitter = 0, idletime = 5, usegrabmethod = 0, waitagain = 0;
- X Window root;
- X Pixmap cursormask;
- X XGCValues xgc;
- X--- 57,93 ----
- X (*defaulthandler)(display,error);
- X }
- X
- X+ char **names; /* -> argv list of names to avoid */
- X+
- X+ /*
- X+ * return true if window has a wm_name and the start of it matches
- X+ * one of the given names to avoid
- X+ */
- X+ nameinlist(display,window)
- X+ Display *display;
- X+ Window window;
- X+ {
- X+ char **cpp;
- X+ char *name;
- X+
- X+ if(names==0)return 0;
- X+ if(XFetchName (display, window, &name)){
- X+ for(cpp = names;*cpp!=0;cpp++){
- X+ if(strncmp(*cpp,name,strlen(*cpp))==0)
- X+ break;
- X+ }
- X+ XFree(name);
- X+ return(*cpp!=0);
- X+ }
- X+ return 0;
- X+ }
- X+
- X main(argc,argv)char **argv;{
- X Display *display;
- X Cursor cursor;
- X int screen,oldx,oldy = -99;
- X! int doroot = 0, jitter = 0, idletime = 5, usegrabmethod = 0, waitagain = 0,
- X! dovisible = 1;
- X Window root;
- X Pixmap cursormask;
- X XGCValues xgc;
- X***************
- X*** 80,85 ****
- X--- 112,124 ----
- X usegrabmethod = 1;
- X }else if(strcmp(*argv,"-reset")==0){
- X waitagain = 1;
- X+ }else if(strcmp(*argv,"-visible")==0){
- X+ dovisible = 0;
- X+ }else if(strcmp(*argv,"-not")==0){
- X+ /* take rest of srg list */
- X+ names = ++argv;
- X+ if(*names==0)names = 0; /* no args follow */
- X+ argc = 0;
- X }else if(strcmp(*argv,"-display")==0){
- X argc--,argv++;
- X if(argc<0)usage();
- X***************
- X*** 110,115 ****
- X--- 149,155 ----
- X Window dummywin,windowin;
- X int rootx,rooty,winx,winy;
- X unsigned int modifs;
- X+ Window lastwindowavoided = None;
- X
- X /* wait for pointer to not move and no buttons down */
- X while(1){
- X***************
- X*** 120,126 ****
- X }else if((!doroot && windowin==None) || (modifs & ANYBUTTON) ||
- X !(ALMOSTEQUAL(rootx,oldx) && ALMOSTEQUAL(rooty,oldy))){
- X oldx = rootx, oldy = rooty;
- X! }else break;
- X sleep(idletime);
- X }
- X /* wait again next time */
- X--- 160,187 ----
- X }else if((!doroot && windowin==None) || (modifs & ANYBUTTON) ||
- X !(ALMOSTEQUAL(rootx,oldx) && ALMOSTEQUAL(rooty,oldy))){
- X oldx = rootx, oldy = rooty;
- X! }else if(windowin==None){
- X! windowin = root;
- X! break;
- X! }else if(windowin!=lastwindowavoided){
- X! /* descend tree of windows under cursor to bottommost */
- X! Window childin;
- X! int toavoid = xFalse;
- X! lastwindowavoided = childin = windowin;
- X! do{
- X! windowin = childin;
- X! if(nameinlist (display, windowin)){
- X! toavoid = xTrue;
- X! break;
- X! }
- X! }while(XQueryPointer(display, windowin, &dummywin,
- X! &childin, &rootx, &rooty, &winx, &winy, &modifs)
- X! && childin!=None);
- X! if(!toavoid){
- X! lastwindowavoided = None;
- X! break;
- X! }
- X! }
- X sleep(idletime);
- X }
- X /* wait again next time */
- X***************
- X*** 146,165 ****
- X Window cursorwindow;
- X Window childin;
- X
- X- /* descend tree of windows under cursor to bottommost */
- X- if(windowin!=None)
- X- while(XQueryPointer(display, windowin, &dummywin, &childin,
- X- &rootx, &rooty, &winx, &winy, &modifs)
- X- && childin!=None)
- X- windowin = childin;
- X- else windowin = root;
- X /* create small input-only window under cursor
- X * as a sub window of the window currently under the cursor
- X */
- X attributes.event_mask = LeaveWindowMask |
- X- VisibilityChangeMask |
- X StructureNotifyMask |
- X FocusChangeMask;
- X attributes.override_redirect = True;
- X attributes.cursor = cursor;
- X cursorwindow = XCreateWindow
- X--- 207,220 ----
- X Window cursorwindow;
- X Window childin;
- X
- X /* create small input-only window under cursor
- X * as a sub window of the window currently under the cursor
- X */
- X attributes.event_mask = LeaveWindowMask |
- X StructureNotifyMask |
- X FocusChangeMask;
- X+ if(dovisible)
- X+ attributes.event_mask |= VisibilityChangeMask;
- X attributes.override_redirect = True;
- X attributes.cursor = cursor;
- X cursorwindow = XCreateWindow
- X***************
- X*** 187,193 ****
- X event.type!=CirculateNotify &&
- X event.type!=ReparentNotify &&
- X event.type!=DestroyNotify &&
- X! event.type!=VisibilityNotify);
- X /* check if a second unclutter is running cos they thrash */
- X if(event.type==LeaveNotify &&
- X event.xcrossing.window==cursorwindow &&
- X--- 242,250 ----
- X event.type!=CirculateNotify &&
- X event.type!=ReparentNotify &&
- X event.type!=DestroyNotify &&
- X! (event.type!=VisibilityNotify ||
- X! event.xvisibility.state==VisibilityUnobscured)
- X! );
- X /* check if a second unclutter is running cos they thrash */
- X if(event.type==LeaveNotify &&
- X event.xcrossing.window==cursorwindow &&
- Xdiff -r -c old/unclutter.man unclutter/unclutter.man
- X*** old/unclutter.man Tue Jun 18 18:15:48 1991
- X--- unclutter/unclutter.man Fri May 24 19:13:55 1991
- X***************
- X*** 14,19 ****
- X--- 14,21 ----
- X .RB [ -grab ]
- X .RB [ -reset ]
- X .RB [ -root ]
- X+ .RB [ -not ]
- X+ .I "name ...
- X .SH DESCRIPTION
- X .B unclutter
- X removes the cursor image from the screen so that it does not
- X***************
- X*** 50,55 ****
- X--- 52,64 ----
- X -root
- X means remove the cursor even if it is on the root background, where in
- X principle it should not be obscuring anything useful.
- X+ .TP
- X+ -not
- X+ is followed by a list of window names where the cursor should not be
- X+ removed.
- X+ The first few characters of the WM_NAME property on the window need
- X+ to match one the listed names.
- X+ This argument must be the last on the command line.
- X .SH LIMITATIONS
- X Unfortunately, clients like emacs set different text cursor
- X shapes depending on whether they have pointer focus or not,
- X***************
- X*** 67,70 ****
- X This situation quickly deteriorates into a fight no one can win, so
- X it is detected when possible and the program gives up.
- X .SH AUTHOR
- X! Mark M Martin. cetia 1991. mmm@cetia.fr
- X--- 76,79 ----
- X This situation quickly deteriorates into a fight no one can win, so
- X it is detected when possible and the program gives up.
- X .SH AUTHOR
- X! Mark M Martin. cetia 24may1991. mmm@cetia.fr
- Xdiff -r -c old/vroot.h unclutter/vroot.h
- X*** old/vroot.h Tue Jun 18 18:15:49 1991
- X--- unclutter/vroot.h Fri May 24 19:13:55 1991
- X***************
- X*** 28,35 ****
- X * after all the X11 header files. It has been tested on such popular
- X * X clients as xphoon, xfroot, xloadimage, and xaqua.
- X *
- X! * Andreas Stolcke (stolcke@ICSI.Berkeley.EDU), 9/7/90
- X! * minor mods signalled with: mmm and DONTOPTIMISE.
- X */
- X #define DONTOPTIMISE /* unclutter needs to search from scratch each time */
- X
- X--- 28,36 ----
- X * after all the X11 header files. It has been tested on such popular
- X * X clients as xphoon, xfroot, xloadimage, and xaqua.
- X *
- X! * Andreas Stolcke <stolcke@ICSI.Berkeley.EDU>, 9/7/90
- X! * - replaced all NULL's with properly cast 0's, 5/6/91
- X! * - free children list (suggested by Mark Martin <mmm@cetia.fr>), 5/16/91
- X */
- X #define DONTOPTIMISE /* unclutter needs to search from scratch each time */
- X
- X***************
- X*** 40,83 ****
- X VirtualRootWindow(dpy, screen)
- X Display *dpy;
- X {
- X! static Display *save_dpy = (Display *)NULL;
- X static int save_screen = -1;
- X! static Window root = (Window)NULL;
- X
- X- Atom __SWM_VROOT = None;
- X- int i;
- X- Window rootReturn, parentReturn, *children;
- X- unsigned int numChildren;
- X-
- X #ifdef DONTOPTIMISE
- X {
- X #else
- X! if ( dpy != save_dpy || screen != save_screen ) {
- X #endif
- X root = RootWindow(dpy, screen);
- X
- X /* go look for a virtual root */
- X __SWM_VROOT = XInternAtom(dpy, "__SWM_VROOT", False);
- X! if(XQueryTree(dpy, root, &rootReturn, &parentReturn,
- X! &children, &numChildren)){ /* mmm */
- X! for (i = 0; i < numChildren; i++) {
- X! Atom actual_type;
- X! int actual_format;
- X! unsigned long nitems, bytesafter; /* mmm */
- X! Window *newRoot = NULL;
- X
- X! if (XGetWindowProperty(dpy, children[i], __SWM_VROOT,
- X! 0, 1, False, XA_WINDOW,
- X! &actual_type, &actual_format,
- X! &nitems, &bytesafter,
- X! (unsigned char **) &newRoot) == Success
- X! && newRoot) {
- X! root = *newRoot;
- X! break;
- X }
- X! }
- X! if(children)XFree((char *)children); /* mmm */
- X }
- X save_dpy = dpy;
- X save_screen = screen;
- X }
- X--- 41,86 ----
- X VirtualRootWindow(dpy, screen)
- X Display *dpy;
- X {
- X! static Display *save_dpy = (Display *)0;
- X static int save_screen = -1;
- X! static Window root = (Window)0;
- X
- X #ifdef DONTOPTIMISE
- X {
- X #else
- X! if (dpy != save_dpy || screen != save_screen) {
- X #endif
- X+ Atom __SWM_VROOT = None;
- X+ int i;
- X+ Window rootReturn, parentReturn, *children;
- X+ unsigned int numChildren;
- X+
- X root = RootWindow(dpy, screen);
- X
- X /* go look for a virtual root */
- X __SWM_VROOT = XInternAtom(dpy, "__SWM_VROOT", False);
- X! if (XQueryTree(dpy, root, &rootReturn, &parentReturn,
- X! &children, &numChildren)) {
- X! for (i = 0; i < numChildren; i++) {
- X! Atom actual_type;
- X! int actual_format;
- X! unsigned long nitems, bytesafter;
- X! Window *newRoot = (Window *)0;
- X
- X! if (XGetWindowProperty(dpy, children[i],
- X! __SWM_VROOT, 0, 1, False, XA_WINDOW,
- X! &actual_type, &actual_format,
- X! &nitems, &bytesafter,
- X! (unsigned char **) &newRoot) == Success
- X! && newRoot) {
- X! root = *newRoot;
- X! break;
- X! }
- X }
- X! if (children)
- X! XFree((char *)children);
- X }
- X+
- X save_dpy = dpy;
- X save_screen = screen;
- X }
- END-OF-FILE!
- if test 13123 -ne "`wc -c <'patches.3'`"
- then echo "shar: error transmitting patches.3 (13123 characters)"
- fi
- fi
- echo 'end of shar part 1 of 1'
- exit 0
-
- --
- Dan Heller
- O'Reilly && Associates Z-Code Software Comp-sources-x:
- Senior Writer President comp-sources-x@uunet.uu.net
- argv@ora.com argv@zipcode.com
-